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

let f be PartFunc of REAL,REAL; :: thesis: ( X c= dom f & f | X is monotone & ex p being Real st f .: X = right_closed_halfline p implies f | X is continuous )
assume that
A1: X c= dom f and
A2: f | X is monotone ; :: thesis: ( for p being Real holds not f .: X = right_closed_halfline p or f | X is continuous )
given p being Real such that A3: f .: X = right_closed_halfline p ; :: thesis: f | X is continuous
set L = right_open_halfline p;
set l = right_closed_halfline p;
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 )
F: x0 in REAL by XREAL_0:def 1;
A4: (f | X) .: X = f .: X by RELAT_1:129;
A5: right_open_halfline p c= right_closed_halfline p by XXREAL_1:22;
assume x0 in dom (f | X) ; :: thesis: f | X is_continuous_in x0
then A6: x0 in X by RELAT_1:57;
then x0 in (dom f) /\ X by A1, XBOOLE_0:def 4;
then A7: x0 in dom (f | X) by RELAT_1:61;
then (f | X) . x0 in (f | X) .: X by A6, FUNCT_1:def 6;
then (f | X) . x0 in {p} \/ (right_open_halfline p) by A3, A4, XXREAL_1:427;
then A8: ( (f | X) . x0 in {p} or (f | X) . x0 in right_open_halfline p ) by XBOOLE_0:def 3;
now
let N1 be Neighbourhood of (f | X) . x0; :: thesis: ex N being Neighbourhood of x0 st
for r1 being real number st r1 in dom (f | X) & r1 in N holds
(f | X) . r1 in N1

now
per cases ( f | X is non-decreasing or f | X is non-increasing ) by A2, RFUNCT_2:def 5;
suppose f | X is non-decreasing ; :: thesis: ex N being Neighbourhood of x0 st
for r1 being real number st r1 in dom (f | X) & r1 in N holds
(f | X) . r1 in N1

then A9: (f | X) | X is non-decreasing ;
now
per cases ( (f | X) . x0 in right_open_halfline p or (f | X) . x0 = p ) by A8, TARSKI:def 1;
suppose (f | X) . x0 in right_open_halfline p ; :: 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

then consider N2 being Neighbourhood of (f | X) . x0 such that
A10: N2 c= right_open_halfline p by RCOMP_1:18;
consider N3 being Neighbourhood of (f | X) . x0 such that
A11: N3 c= N1 and
A12: N3 c= N2 by RCOMP_1:17;
consider r being real number such that
A13: r > 0 and
A14: N3 = ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by RCOMP_1:def 6;
reconsider r = r as Real by XREAL_0:def 1;
A15: ((f | X) . x0) + (r / 2) < (((f | X) . x0) + (r / 2)) + (r / 2) by A13, XREAL_1:29, XREAL_1:215;
set M2 = ((f | X) . x0) + (r / 2);
A16: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A13, XREAL_1:29, XREAL_1:215;
A17: (f | X) . x0 < ((f | X) . x0) + r by A13, XREAL_1:29;
then ((f | X) . x0) - r < (((f | X) . x0) + r) - r by XREAL_1:9;
then ((f | X) . x0) - r < ((f | X) . x0) + (r / 2) by A16, XXREAL_0:2;
then A18: ((f | X) . x0) + (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A15;
then ((f | X) . x0) + (r / 2) in N2 by A12, A14;
then ((f | X) . x0) + (r / 2) in right_open_halfline p by A10;
then consider r2 being Real such that
A19: ( r2 in dom (f | X) & r2 in X ) and
A20: ((f | X) . x0) + (r / 2) = (f | X) . r2 by A3, A4, A5, PARTFUN2:59;
A21: ((f | X) . x0) + (r / 2) > (f | X) . x0 by A13, XREAL_1:29, XREAL_1:215;
A22: now
assume A23: r2 < x0 ; :: thesis: contradiction
( x0 in X /\ (dom (f | X)) & r2 in X /\ (dom (f | X)) ) by A6, A7, A19, XBOOLE_0:def 4;
hence contradiction by A9, A20, A21, A23, RFUNCT_2:22, F; :: thesis: verum
end;
set M1 = ((f | X) . x0) - (r / 2);
A24: ((f | X) . x0) - r < (((f | X) . x0) - r) + (r / 2) by A13, XREAL_1:29, XREAL_1:215;
((f | X) . x0) - (r / 2) < (f | X) . x0 by A16, XREAL_1:19;
then ((f | X) . x0) - (r / 2) < ((f | X) . x0) + r by A17, XXREAL_0:2;
then A25: ((f | X) . x0) - (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A24;
then ((f | X) . x0) - (r / 2) in N2 by A12, A14;
then ((f | X) . x0) - (r / 2) in right_open_halfline p by A10;
then consider r1 being Real such that
A26: ( r1 in dom (f | X) & r1 in X ) and
A27: ((f | X) . x0) - (r / 2) = (f | X) . r1 by A3, A4, A5, PARTFUN2:59;
A28: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A13, XREAL_1:29, XREAL_1:215;
then A29: ((f | X) . x0) - (r / 2) < (f | X) . x0 by XREAL_1:19;
A30: now
assume A31: x0 < r1 ; :: thesis: contradiction
( x0 in X /\ (dom (f | X)) & r1 in X /\ (dom (f | X)) ) by A6, A7, A26, XBOOLE_0:def 4;
hence contradiction by A9, A27, A29, A31, RFUNCT_2:22, F; :: thesis: verum
end;
x0 <> r2 by A13, A20, XREAL_1:29, XREAL_1:215;
then x0 < r2 by A22, XXREAL_0:1;
then A32: r2 - x0 > 0 by XREAL_1:50;
set R = min ((x0 - r1),(r2 - x0));
A33: min ((x0 - r1),(r2 - x0)) <= r2 - x0 by XXREAL_0:17;
r1 <> x0 by A27, A28, XREAL_1:19;
then r1 < x0 by A30, XXREAL_0:1;
then x0 - r1 > 0 by XREAL_1:50;
then min ((x0 - r1),(r2 - x0)) > 0 by A32, 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 6;
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 )
G: x in REAL by XREAL_0:def 1;
assume that
A34: x in dom (f | X) and
A35: x in N ; :: thesis: (f | X) . x in N1
A36: x in X /\ (dom (f | X)) by A34, RELAT_1:58, XBOOLE_1:28;
A37: ex s being Real st
( s = x & x0 - (min ((x0 - r1),(r2 - x0))) < s & s < x0 + (min ((x0 - r1),(r2 - x0))) ) by A35;
then x0 < (min ((x0 - r1),(r2 - x0))) + x by XREAL_1:19;
then A38: x0 - x < ((min ((x0 - r1),(r2 - x0))) + x) - x by XREAL_1:9;
min ((x0 - r1),(r2 - x0)) <= x0 - r1 by XXREAL_0:17;
then x0 - x < x0 - r1 by A38, XXREAL_0:2;
then - (x0 - x) > - (x0 - r1) by XREAL_1:24;
then A39: (x - x0) + x0 > (r1 - x0) + x0 by XREAL_1:6;
r1 in X /\ (dom (f | X)) by A26, XBOOLE_0:def 4;
then A40: (f | X) . r1 <= (f | X) . x by A9, A39, A36, RFUNCT_2:22, F, G;
x - x0 < min ((x0 - r1),(r2 - x0)) by A37, XREAL_1:19;
then x - x0 < r2 - x0 by A33, XXREAL_0:2;
then A41: (x - x0) + x0 < (r2 - x0) + x0 by XREAL_1:6;
r2 in X /\ (dom (f | X)) by A19, XBOOLE_0:def 4;
then (f | X) . x <= (f | X) . r2 by A9, A41, A36, RFUNCT_2:22, F, G;
then A42: (f | X) . x in [.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] by A27, A20, A40;
[.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] c= ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A25, A18, XXREAL_2:def 12;
then (f | X) . x in N3 by A14, A42;
hence (f | X) . x in N1 by A11; :: thesis: verum
end;
suppose A43: (f | X) . x0 = p ; :: 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

then consider r being real number such that
A44: r > 0 and
A45: N1 = ].(p - r),(p + r).[ by RCOMP_1:def 6;
reconsider r = r as Real by XREAL_0:def 1;
set R = r / 2;
A46: p - (r / 2) < p by A44, XREAL_1:44, XREAL_1:215;
A47: p < p + (r / 2) by A44, XREAL_1:29, XREAL_1:215;
then p + (r / 2) in { s where s is Real : p < s } ;
then p + (r / 2) in right_open_halfline p by XXREAL_1:230;
then consider r1 being Real such that
A48: ( r1 in dom (f | X) & r1 in X ) and
A49: p + (r / 2) = (f | X) . r1 by A3, A4, A5, PARTFUN2:59;
A50: now
assume A51: x0 > r1 ; :: thesis: contradiction
( x0 in X /\ (dom (f | X)) & r1 in X /\ (dom (f | X)) ) by A6, A7, A48, XBOOLE_0:def 4;
hence contradiction by A9, A43, A47, A49, A51, RFUNCT_2:22, F; :: thesis: verum
end;
r1 <> x0 by A43, A44, A49, XREAL_1:29, XREAL_1:215;
then r1 > x0 by A50, XXREAL_0:1;
then reconsider N = ].(x0 - (r1 - x0)),(x0 + (r1 - x0)).[ as Neighbourhood of x0 by RCOMP_1:def 6, XREAL_1:50;
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 that
A52: x in dom (f | X) and
A53: x in N ; :: thesis: (f | X) . x in N1
A54: ex s being Real st
( s = x & x0 - (r1 - x0) < s & s < x0 + (r1 - x0) ) by A53;
A55: dom (f | X) c= X by RELAT_1:58;
then (f | X) . x in right_closed_halfline p by A3, A4, A52, FUNCT_1:def 6;
then (f | X) . x in { s where s is Real : p <= s } by XXREAL_1:232;
then ex s being Real st
( s = (f | X) . x & p <= s ) ;
then A56: p - (r / 2) <= (f | X) . x by A46, XXREAL_0:2;
A57: r1 in X /\ (dom (f | X)) by A48, XBOOLE_0:def 4;
x in X /\ (dom (f | X)) by A52, A55, XBOOLE_0:def 4;
then p + (r / 2) >= (f | X) . x by A9, A49, A57, A54, RFUNCT_2:22;
then A58: (f | X) . x in [.(p - (r / 2)),(p + (r / 2)).] by A56;
A59: r / 2 < r by A44, XREAL_1:216;
then A60: p - r < p - (r / 2) by XREAL_1:15;
p < p + r by A44, XREAL_1:29;
then p - (r / 2) < p + r by A46, XXREAL_0:2;
then A61: p - (r / 2) in ].(p - r),(p + r).[ by A60;
A62: p + (r / 2) < p + r by A59, XREAL_1:6;
p - r < p by A44, XREAL_1:44;
then p - r < p + (r / 2) by A47, XXREAL_0:2;
then p + (r / 2) in ].(p - r),(p + r).[ by A62;
then [.(p - (r / 2)),(p + (r / 2)).] c= N1 by A45, A61, XXREAL_2:def 12;
hence (f | X) . x in N1 by A58; :: thesis: verum
end;
end;
end;
hence ex N being Neighbourhood of x0 st
for r1 being real number st r1 in dom (f | X) & r1 in N holds
(f | X) . r1 in N1 ; :: thesis: verum
end;
suppose f | X is non-increasing ; :: thesis: ex N being Neighbourhood of x0 st
for r1 being real number st r1 in dom (f | X) & r1 in N holds
(f | X) . r1 in N1

then A63: (f | X) | X is non-increasing by RELAT_1:72;
now
per cases ( (f | X) . x0 in right_open_halfline p or (f | X) . x0 = p ) by A8, TARSKI:def 1;
suppose (f | X) . x0 in right_open_halfline p ; :: 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

then consider N2 being Neighbourhood of (f | X) . x0 such that
A64: N2 c= right_open_halfline p by RCOMP_1:18;
consider N3 being Neighbourhood of (f | X) . x0 such that
A65: N3 c= N1 and
A66: N3 c= N2 by RCOMP_1:17;
consider r being real number such that
A67: r > 0 and
A68: N3 = ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by RCOMP_1:def 6;
reconsider r = r as Real by XREAL_0:def 1;
A69: ((f | X) . x0) + (r / 2) < (((f | X) . x0) + (r / 2)) + (r / 2) by A67, XREAL_1:29, XREAL_1:215;
set M2 = ((f | X) . x0) + (r / 2);
A70: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A67, XREAL_1:29, XREAL_1:215;
A71: (f | X) . x0 < ((f | X) . x0) + r by A67, XREAL_1:29;
then ((f | X) . x0) - r < (((f | X) . x0) + r) - r by XREAL_1:9;
then ((f | X) . x0) - r < ((f | X) . x0) + (r / 2) by A70, XXREAL_0:2;
then A72: ((f | X) . x0) + (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A69;
then ((f | X) . x0) + (r / 2) in N2 by A66, A68;
then ((f | X) . x0) + (r / 2) in right_open_halfline p by A64;
then consider r2 being Real such that
A73: ( r2 in dom (f | X) & r2 in X ) and
A74: ((f | X) . x0) + (r / 2) = (f | X) . r2 by A3, A4, A5, PARTFUN2:59;
A75: ((f | X) . x0) + (r / 2) > (f | X) . x0 by A67, XREAL_1:29, XREAL_1:215;
A76: now
assume A77: r2 > x0 ; :: thesis: contradiction
( x0 in X /\ (dom (f | X)) & r2 in X /\ (dom (f | X)) ) by A6, A7, A73, XBOOLE_0:def 4;
hence contradiction by A63, A74, A75, A77, RFUNCT_2:23, F; :: thesis: verum
end;
set M1 = ((f | X) . x0) - (r / 2);
A78: ((f | X) . x0) - r < (((f | X) . x0) - r) + (r / 2) by A67, XREAL_1:29, XREAL_1:215;
((f | X) . x0) - (r / 2) < (f | X) . x0 by A70, XREAL_1:19;
then ((f | X) . x0) - (r / 2) < ((f | X) . x0) + r by A71, XXREAL_0:2;
then A79: ((f | X) . x0) - (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A78;
then ((f | X) . x0) - (r / 2) in N2 by A66, A68;
then ((f | X) . x0) - (r / 2) in right_open_halfline p by A64;
then consider r1 being Real such that
A80: ( r1 in dom (f | X) & r1 in X ) and
A81: ((f | X) . x0) - (r / 2) = (f | X) . r1 by A3, A4, A5, PARTFUN2:59;
A82: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A67, XREAL_1:29, XREAL_1:215;
then A83: ((f | X) . x0) - (r / 2) < (f | X) . x0 by XREAL_1:19;
A84: now
assume A85: x0 > r1 ; :: thesis: contradiction
( x0 in X /\ (dom (f | X)) & r1 in X /\ (dom (f | X)) ) by A6, A7, A80, XBOOLE_0:def 4;
hence contradiction by A63, A81, A83, A85, RFUNCT_2:23, F; :: thesis: verum
end;
x0 <> r2 by A67, A74, XREAL_1:29, XREAL_1:215;
then x0 > r2 by A76, XXREAL_0:1;
then A86: x0 - r2 > 0 by XREAL_1:50;
set R = min ((r1 - x0),(x0 - r2));
A87: min ((r1 - x0),(x0 - r2)) <= r1 - x0 by XXREAL_0:17;
r1 <> x0 by A81, A82, XREAL_1:19;
then r1 > x0 by A84, XXREAL_0:1;
then r1 - x0 > 0 by XREAL_1:50;
then min ((r1 - x0),(x0 - r2)) > 0 by A86, 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 6;
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 )
G: x in REAL by XREAL_0:def 1;
assume that
A88: x in dom (f | X) and
A89: x in N ; :: thesis: (f | X) . x in N1
A90: x in X /\ (dom (f | X)) by A88, RELAT_1:58, XBOOLE_1:28;
A91: ex s being Real st
( s = x & x0 - (min ((r1 - x0),(x0 - r2))) < s & s < x0 + (min ((r1 - x0),(x0 - r2))) ) by A89;
then x0 < (min ((r1 - x0),(x0 - r2))) + x by XREAL_1:19;
then A92: x0 - x < ((min ((r1 - x0),(x0 - r2))) + x) - x by XREAL_1:9;
x - x0 < min ((r1 - x0),(x0 - r2)) by A91, XREAL_1:19;
then x - x0 < r1 - x0 by A87, XXREAL_0:2;
then A93: (x - x0) + x0 < (r1 - x0) + x0 by XREAL_1:6;
r1 in X /\ (dom (f | X)) by A80, XBOOLE_0:def 4;
then A94: (f | X) . r1 <= (f | X) . x by A63, A93, A90, RFUNCT_2:23, F, G;
min ((r1 - x0),(x0 - r2)) <= x0 - r2 by XXREAL_0:17;
then x0 - x < x0 - r2 by A92, XXREAL_0:2;
then - (x0 - x) > - (x0 - r2) by XREAL_1:24;
then A95: (x - x0) + x0 > (r2 - x0) + x0 by XREAL_1:6;
r2 in X /\ (dom (f | X)) by A73, XBOOLE_0:def 4;
then (f | X) . x <= (f | X) . r2 by A63, A95, A90, RFUNCT_2:23, F, G;
then A96: (f | X) . x in [.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] by A81, A74, A94;
[.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] c= ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A79, A72, XXREAL_2:def 12;
then (f | X) . x in N3 by A68, A96;
hence (f | X) . x in N1 by A65; :: thesis: verum
end;
suppose A97: (f | X) . x0 = p ; :: 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

then consider r being real number such that
A98: r > 0 and
A99: N1 = ].(p - r),(p + r).[ by RCOMP_1:def 6;
reconsider r = r as Real by XREAL_0:def 1;
set R = r / 2;
A100: p - (r / 2) < p by A98, XREAL_1:44, XREAL_1:215;
A101: p < p + (r / 2) by A98, XREAL_1:29, XREAL_1:215;
then p + (r / 2) in { s where s is Real : p < s } ;
then p + (r / 2) in right_open_halfline p by XXREAL_1:230;
then consider r1 being Real such that
A102: ( r1 in dom (f | X) & r1 in X ) and
A103: p + (r / 2) = (f | X) . r1 by A3, A4, A5, PARTFUN2:59;
A104: now
assume A105: x0 < r1 ; :: thesis: contradiction
( x0 in X /\ (dom (f | X)) & r1 in X /\ (dom (f | X)) ) by A6, A7, A102, XBOOLE_0:def 4;
hence contradiction by A63, A97, A101, A103, A105, RFUNCT_2:23, F; :: thesis: verum
end;
r1 <> x0 by A97, A98, A103, XREAL_1:29, XREAL_1:215;
then r1 < x0 by A104, XXREAL_0:1;
then reconsider N = ].(x0 - (x0 - r1)),(x0 + (x0 - r1)).[ as Neighbourhood of x0 by RCOMP_1:def 6, XREAL_1:50;
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 that
A106: x in dom (f | X) and
A107: x in N ; :: thesis: (f | X) . x in N1
A108: ex s being Real st
( s = x & x0 - (x0 - r1) < s & s < x0 + (x0 - r1) ) by A107;
A109: dom (f | X) c= X by RELAT_1:58;
then (f | X) . x in right_closed_halfline p by A3, A4, A106, FUNCT_1:def 6;
then (f | X) . x in { s where s is Real : p <= s } by XXREAL_1:232;
then ex s being Real st
( s = (f | X) . x & p <= s ) ;
then A110: p - (r / 2) <= (f | X) . x by A100, XXREAL_0:2;
A111: r1 in X /\ (dom (f | X)) by A102, XBOOLE_0:def 4;
x in X /\ (dom (f | X)) by A106, A109, XBOOLE_0:def 4;
then p + (r / 2) >= (f | X) . x by A63, A103, A111, A108, RFUNCT_2:23;
then A112: (f | X) . x in [.(p - (r / 2)),(p + (r / 2)).] by A110;
A113: r / 2 < r by A98, XREAL_1:216;
then A114: p - r < p - (r / 2) by XREAL_1:15;
p < p + r by A98, XREAL_1:29;
then p - (r / 2) < p + r by A100, XXREAL_0:2;
then A115: p - (r / 2) in ].(p - r),(p + r).[ by A114;
A116: p + (r / 2) < p + r by A113, XREAL_1:6;
p - r < p by A98, XREAL_1:44;
then p - r < p + (r / 2) by A101, XXREAL_0:2;
then p + (r / 2) in ].(p - r),(p + r).[ by A116;
then [.(p - (r / 2)),(p + (r / 2)).] c= N1 by A99, A115, XXREAL_2:def 12;
hence (f | X) . x in N1 by A112; :: thesis: verum
end;
end;
end;
hence ex N being Neighbourhood of x0 st
for r1 being real number st r1 in dom (f | X) & r1 in N holds
(f | X) . r1 in N1 ; :: thesis: verum
end;
end;
end;
hence ex N being Neighbourhood of x0 st
for r1 being real number st r1 in dom (f | X) & r1 in N holds
(f | X) . r1 in N1 ; :: 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