let X be TopSpace; :: thesis: for R being non empty SubSpace of R^1
for f, g being continuous Function of X,R ex h being continuous Function of X,R st
for x being Point of X holds h . x = max (f . x),(g . x)

let R be non empty SubSpace of R^1 ; :: thesis: for f, g being continuous Function of X,R ex h being continuous Function of X,R st
for x being Point of X holds h . x = max (f . x),(g . x)

let f, g be continuous Function of X,R; :: thesis: ex h being continuous Function of X,R st
for x being Point of X holds h . x = max (f . x),(g . x)

defpred S1[ set ] means f . $1 >= g . $1;
consider A being Subset of X such that
A1: for a being set holds
( a in A iff ( a in the carrier of X & S1[a] ) ) from SUBSET_1:sch 1();
defpred S2[ set ] means f . $1 <= g . $1;
consider B being Subset of X such that
A2: for a being set holds
( a in B iff ( a in the carrier of X & S2[a] ) ) from SUBSET_1:sch 1();
per cases ( X is empty or ( not X is empty & A is empty ) or ( not X is empty & B is empty ) or ( not X is empty & not A is empty & not B is empty ) ) ;
suppose A3: X is empty ; :: thesis: ex h being continuous Function of X,R st
for x being Point of X holds h . x = max (f . x),(g . x)

consider h being continuous Function of X,R;
take h ; :: thesis: for x being Point of X holds h . x = max (f . x),(g . x)
let x be Point of X; :: thesis: h . x = max (f . x),(g . x)
( dom f = the carrier of X & dom g = the carrier of X & dom h = the carrier of X & the carrier of X is empty ) by A3, FUNCT_2:def 1;
then ( h . x = 0 & f . x = 0 & g . x = 0 ) by FUNCT_1:def 4;
hence h . x = max (f . x),(g . x) ; :: thesis: verum
end;
suppose A4: ( not X is empty & A is empty ) ; :: thesis: ex h being continuous Function of X,R st
for x being Point of X holds h . x = max (f . x),(g . x)

take g ; :: thesis: for x being Point of X holds g . x = max (f . x),(g . x)
let x be Point of X; :: thesis: g . x = max (f . x),(g . x)
( not x in A & the carrier of X <> {} ) by A4;
then f . x < g . x by A1;
hence g . x = max (f . x),(g . x) by XXREAL_0:def 10; :: thesis: verum
end;
suppose A5: ( not X is empty & B is empty ) ; :: thesis: ex h being continuous Function of X,R st
for x being Point of X holds h . x = max (f . x),(g . x)

take f ; :: thesis: for x being Point of X holds f . x = max (f . x),(g . x)
let x be Point of X; :: thesis: f . x = max (f . x),(g . x)
( not x in B & the carrier of X <> {} ) by A5;
then g . x < f . x by A2;
hence f . x = max (f . x),(g . x) by XXREAL_0:def 10; :: thesis: verum
end;
suppose A6: ( not X is empty & not A is empty & not B is empty ) ; :: thesis: ex h being continuous Function of X,R st
for x being Point of X holds h . x = max (f . x),(g . x)

then reconsider X' = X as non empty TopSpace ;
for x being Point of X' holds
( ( x in A implies f . x >= g . x ) & ( f . x >= g . x implies x in A ) & ( x in B implies f . x <= g . x ) & ( f . x <= g . x implies x in B ) ) by A1, A2;
then reconsider A' = A, B' = B as non empty closed Subset of X' by A6, Th53;
reconsider ff = f, gg = g as continuous Function of X',R ;
A7: ( dom ff = the carrier of X' & dom gg = the carrier of X' ) by FUNCT_2:def 1;
then A8: ( dom (ff | A') = A' & dom (gg | B') = B' ) by RELAT_1:91;
the carrier of (X' | A') = [#] (X' | A')
.= A' by PRE_TOPC:def 10 ;
then reconsider f' = ff | A' as continuous Function of (X' | A'),R by A8, FUNCT_2:def 1, RELSET_1:33, TOPMETR:10;
the carrier of (X' | B') = [#] (X' | B')
.= B' by PRE_TOPC:def 10 ;
then reconsider g' = gg | B' as continuous Function of (X' | B'),R by A8, FUNCT_2:def 1, RELSET_1:33, TOPMETR:10;
A9: A' \/ B' = the carrier of X'
proof
thus A' \/ B' c= the carrier of X' ; :: according to XBOOLE_0:def 10 :: thesis: the carrier of X' c= A' \/ B'
let a be set ; :: according to TARSKI:def 3 :: thesis: ( not a in the carrier of X' or a in A' \/ B' )
( f . a >= g . a or f . a <= g . a ) ;
then ( not a in the carrier of X or a in A' or a in B' ) by A1, A2;
hence ( not a in the carrier of X' or a in A' \/ B' ) by XBOOLE_0:def 3; :: thesis: verum
end;
then A10: X' | (A' \/ B') = X' | ([#] X')
.= TopStruct(# the carrier of X,the topology of X #) by TSEP_1:100 ;
A11: ( dom f' = A & dom g' = B ) by A7, RELAT_1:91;
A12: f' tolerates g'
proof
let a be set ; :: according to PARTFUN1:def 6 :: thesis: ( not a in (proj1 f') /\ (proj1 g') or f' . a = g' . a )
assume a in (dom f') /\ (dom g') ; :: thesis: f' . a = g' . a
then A13: ( a in A & a in B ) by A11, XBOOLE_0:def 4;
then ( f . a <= g . a & f . a >= g . a ) by A1, A2;
then f . a = g . a by XXREAL_0:1;
hence f' . a = g . a by A13, FUNCT_1:72
.= g' . a by A13, FUNCT_1:72 ;
:: thesis: verum
end;
then ( f' +* g' is continuous Function of (X' | (A' \/ B')),R & TopStruct(# the carrier of R,the topology of R #) = TopStruct(# the carrier of R,the topology of R #) ) by Th14;
then reconsider h = f' +* g' as continuous Function of X,R by A10, YELLOW12:36;
take h ; :: thesis: for x being Point of X holds h . x = max (f . x),(g . x)
let x be Point of X; :: thesis: h . x = max (f . x),(g . x)
( x in the carrier of X' & ( x in A' or x in B' ) ) by A9, XBOOLE_0:def 3;
then ( ( x in A' & f . x >= g . x & h . x = f' . x & f . x = f' . x ) or ( x in B' & f . x <= g . x & h . x = g' . x & g . x = g' . x ) ) by A1, A2, A11, A12, FUNCT_1:72, FUNCT_4:14, FUNCT_4:16;
hence h . x = max (f . x),(g . x) by XXREAL_0:def 10; :: thesis: verum
end;
end;