
theorem ::: TODO just: min (f,g) is continuous
for F,f,g be Function of REAL,REAL st
f is continuous & g is continuous &
for x be Real holds F.x = min(f.x, g.x)
holds
F is continuous
proof
 let F,f,g be Function of REAL,REAL;
 assume B1a: f is continuous;
 assume A1a:g is continuous;
 assume A0:for x be Real holds F.x= min(f.x, g.x);
 reconsider F as PartFunc of REAL,REAL;
 for x0 being Real st x0 in dom F holds F is_continuous_in x0
 proof
  let x0 be Real;
  assume A2: x0 in dom F;
 B0a: dom F = REAL & dom g = REAL & dom f = REAL by FUNCT_2:def 1;
  for r being Real st 0 < r holds
  ex s being Real st
  ( 0 < s & ( for x1 being Real st x1 in dom F & |.(x1 - x0).| < s holds
  |.((F . x1) - (F . x0)).| < r ) )
  proof
   let r be Real;
   assume A4a: 0 < r;
   consider sg being Real such that
   S1: 0 < sg and
   S2: for x1 being Real st x1 in dom g & |.(x1 - x0).| < sg holds
          |.((g . x1) - (g . x0)).| < r/2 by A4a,FCONT_1:3,A1a,A2,B0a;
   consider sf being Real such that
   P1: 0 < sf and
   P2: for x1 being Real st x1 in dom f & |.(x1 - x0).| < sf holds
          |.((f . x1) - (f . x0)).| < r/2 by FCONT_1:3,B0a,B1a,A2,A4a;
   reconsider s = min(sf,sg) as Real;
   P8:  s <= sg & s <= sf by XXREAL_0:17;
   take s;
   for x1 being Real st x1 in dom F & |.(x1 - x0).| < s holds
      |.((F . x1) - (F . x0)).| < r
   proof
    let x1 be Real;
    assume S6: x1 in dom F;
    S8a: dom F = REAL & dom g = REAL & dom f = REAL by FUNCT_2:def 1;
    assume |.(x1 - x0).| < s; then
    |.(x1 - x0).| < sg & |.(x1 - x0).| < sf by P8,XXREAL_0:2; then
    |.((g . x1) - (g . x0)).| < r/2 & |.((f . x1) - (f . x0)).| < r/2
            by S8a,S2,P2,S6; then
    |.((g . x1) - (g . x0)).| + |.((f . x1) - (f . x0)).| < r/2+r/2
         by XREAL_1:8; then
    SS: (|.((g . x1) - (g . x0)).| + |.((f . x1) - (f . x0)).|)
    +(|.((g . x1) - (g . x0)).| + |.((f . x1) - (f . x0)).|)
     < (r/2+r/2)+(r/2+r/2) by XREAL_1:8;
    T3: |.((F . x1) - (F . x0)).|
     =|. min(f.x1, g.x1) - F.x0 .| by A0
    .=|.min(f.x1, g.x1) - min(f.x0, g.x0).| by A0
    .=|.min(f.x1, g.x1) - ((f.x0 + g.x0) - |.f.x0 - g.x0.|) / 2.|
       by COMPLEX1:73
    .=|.((f.x1 + g.x1) - |.f.x1 - g.x1.|) / 2
       - ((f.x0 + g.x0) - |.f.x0 - g.x0.|) / 2.| by COMPLEX1:73
    .=|.((f.x1 - f.x0) + (g.x1 - g.x0)
         + (|.f.x0 - g.x0.|- |.f.x1 - g.x1.|)) / 2.|
    .=|.((f.x1 - f.x0) + (g.x1 - g.x0)
         + (|.f.x0 - g.x0.|- |.f.x1 - g.x1.|)).| / |.2.| by COMPLEX1:67
    .=|.(f.x1 - f.x0) + (g.x1 - g.x0)
         + (|.f.x0 - g.x0.|- |.f.x1 - g.x1.|).| / 2 by COMPLEX1:43;
    T1: |.(f.x1 - f.x0) + (g.x1 - g.x0)
      + (|.f.x0 - g.x0.|- |.f.x1 - g.x1.|).|
    <= |.(f.x1 - f.x0) + (g.x1 - g.x0) .|
      + |. (|.f.x0 - g.x0.| - |.f.x1 - g.x1.|).| by COMPLEX1:56;
    |.(f.x1 - f.x0) + (g.x1 - g.x0) .|
       + |. (|.f.x0 - g.x0.| - |.f.x1 - g.x1.|).|
     <= |.(f.x1 - f.x0) .|+|. (g.x1 - g.x0) .|
      + |. (|.f.x0 - g.x0.| - |.f.x1 - g.x1.|).| by XREAL_1:6,COMPLEX1:56;
    then
    T2: |.(f.x1 - f.x0) + (g.x1 - g.x0)
       + (|.f.x0 - g.x0.|- |.f.x1 - g.x1.|).|
     <= |.(f.x1 - f.x0) .|+|. (g.x1 - g.x0) .|
       + |. (|.f.x0 - g.x0.| - |.f.x1 - g.x1.|).| by XXREAL_0:2,T1;
    |. (|.f.x0 - g.x0.| - |.f.x1 - g.x1.|).|
       <=|. (f.x0 - g.x0) - (f.x1 - g.x1).| &
    |. (f.x0 - g.x0) - (f.x1 - g.x1).|=|. (g.x1-g.x0) - (f.x1-f.x0).| &
    |. ( g.x1- g.x0) - (f.x1 - f.x0).|
     <= |. g.x1-g.x0 .|+|.(f.x1 - f.x0).| by COMPLEX1:57,COMPLEX1:64; then
    |. (|.f.x0 - g.x0.| - |.f.x1 - g.x1.|).|
     <=|.(f.x1 - f.x0).|+|. ( g.x1- g.x0) .| by XXREAL_0:2; then
    |. (|.f.x0 - g.x0.| - |.f.x1 - g.x1.|).|+
            (|.(f.x1 - f.x0) .|+|. (g.x1 - g.x0) .|)
      <=|.(f.x1 - f.x0).|+|. ( g.x1- g.x0) .|+
        (|.(f.x1 - f.x0) .|+|. (g.x1 - g.x0) .|) by XREAL_1:6; then
    |.(f.x1 - f.x0) + (g.x1 - g.x0) + (|.f.x0 - g.x0.|- |.f.x1 -g.x1.|).|
       <= (|.(f.x1 - f.x0) .|+|. (g.x1 - g.x0) .|)+
     |.(f.x1 - f.x0).|+|. ( g.x1- g.x0) .| by XXREAL_0:2,T2; then
    |.(f.x1 - f.x0) + (g.x1 - g.x0) + (|.f.x0 - g.x0.|- |.f.x1- g.x1.|).|
       < (r/2+r/2)+(r/2+r/2) by XXREAL_0:2,SS; then
    |.(f.x1 - f.x0) + (g.x1-g.x0) + (|.f.x0-g.x0.|-|.f.x1- g.x1.|).|/2
      < (r/2+r/2+r/2+r/2)/2 by XREAL_1:74;
    hence |.((F . x1) - (F . x0)).| < r by T3;
   end;
   hence thesis by XXREAL_0:21,S1,P1;
  end;
  hence F is_continuous_in x0 by FCONT_1:3;
 end;
 hence thesis;
end;
