reserve A for non empty closed_interval Subset of REAL;

theorem Th1:
for c being Real, f,g be PartFunc of REAL,REAL st
f is continuous & g is continuous & f . c = g . c &
].-infty,c.] c= dom f & [.c,+infty.[ c= dom g
holds (f | ].-infty,c.]) +* (g | [.c,+infty.[) is continuous
proof
 let c be Real, f,g be PartFunc of REAL,REAL;
 assume that
 A1a: f is continuous & g is continuous and
 A2: f.c = g.c and
 A3: ].-infty,c.] c= dom f & [.c,+infty.[ c= dom g;
 set F = (f|].-infty,c.]) +* (g|[.c,+infty.[);
 set Df = ].-infty,c.];
 set Dg = [.c,+infty.[;
 A1: (f|Df) is continuous & (g|[.c,+infty.[) is continuous by A1a;
 AD: dom (f|Df) = Df & dom (g|Dg) = Dg by RELAT_1:62,A3;
 A7: c in Df & c in Dg by XXREAL_1:234,XXREAL_1:236;
 for x0 being Real st x0 in dom F holds F is_continuous_in x0
 proof
  let x0 be Real;
  assume x0 in dom F;
  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
   A4: 0 < r;
   per cases;
    suppose P2a: x0 < c; then
     P2: x0 in Df by XXREAL_1:234;
     consider sf being Real such that
     P3: 0 < sf and
     P4: for x1 being Real st x1 in Df & |. x1 - x0 .| < sf holds
     |. f.x1 - f.x0 .| < r/2 by FCONT_1:14,A1,A3,P2,A4;
     consider sg being Real such that
     P8: 0 < sg and
     P9: for x1 being Real st x1 in Dg & |. x1 - c .| < sg holds
     |. g . x1 - g . c .| < r/2 by FCONT_1:14,A1,A3,A7,A4;
     SMin: min(sf,sg) <= sf & min(sf,sg) <= sg by XXREAL_0:17;
     take min(sf,sg);
     for x1 being Real st x1 in dom F & |.x1 - x0.| < min(sf,sg)
     holds
     |.F.x1 - F.x0.| < r
     proof
      let x1 be Real;
      assume that
      x1 in dom F and
      P7: |.x1 - x0.| < min(sf,sg);
      PF: |.F.x1 - F.x0.|
       = |.F.x1 - ((f|Df) . x0).| by FUNCT_4:11,XXREAL_1:236,P2a,AD
      .= |.F.x1 - f.x0.| by FUNCT_1:49,XXREAL_1:234,P2a;
      per cases;
       suppose P11: x1 < c; then
        not x1 in Dg by XXREAL_1:236; then
        P12: not x1 in dom (g|Dg) by RELAT_1:62,A3;
        P13: x1 in Df by XXREAL_1:234,P11;
        P7a: |.x1 - x0.| < sf by XXREAL_0:2,P7,SMin;
        |.F.x1 - F.x0.|
        = |.((f|Df) . x1) - f.x0.| by FUNCT_4:11,P12,PF
         .= |.f.x1 - f.x0.| by FUNCT_1:49,XXREAL_1:234,P11;
        then
        P14: |.F.x1 - F.x0.| < r/2 by P4,P13,P7a;
        r/2 +0 < r/2+ r/2 by XREAL_1:8,A4;
        hence |.(F . x1) - F.x0.| < r by XXREAL_0:2,P14;
       end;
       suppose P21: x1 >= c; then
        P22:x1 in Dg by XXREAL_1:236;
        P22b: x0 <= x1 by P2a,P21,XXREAL_0:2; then
        c-c <= x1-c & x0-x0 <= x1-x0 by XREAL_1:13,P21;then
        X1: |. x1-c .|= x1-c & x1-x0 = |. x1-x0 .| by COMPLEX1:43;
        |. x1-c .| <= |. x1-x0 .| by XREAL_1:13,P2a,X1; then
        |. x1-c .| < min(sf,sg) by XXREAL_0:2,P7;then
        |. x1-c .| < sg by XXREAL_0:2,SMin;then
       P23: |. g.x1 - g.c .| < r/2 by P9,P22;
        c-x0 >= c-c by XREAL_1:13,P2a; then
        X2: c-x0 = |. c-x0 .| by COMPLEX1:43;
        x0-x0 <= x1-x0 by XREAL_1:13,P22b;then
        X3: x1-x0 = |. x1-x0 .| by COMPLEX1:43;
        |. c-x0 .| <= |. x1-x0 .| by XREAL_1:13,P21,X2,X3; then
        |. c-x0 .| < min(sf,sg) by XXREAL_0:2,P7;then
        |. c-x0 .| < sf by XXREAL_0:2,SMin;then
       P24: |. f.c - f.x0 .| < r/2 by P4,A7;
       x1 in dom (g|Dg) by RELAT_1:62,A3,P22; then
       P26: |.(F . x1) - (F . x0).|
        = |. (g|Dg) .x1 - f.x0 .| by FUNCT_4:13,PF
        .= |. g .x1 -g.c + f.c - f.x0 .|
                   by A2,FUNCT_1:49,XXREAL_1:236,P21;
       P27: |. (g .x1 -g.c) + (f.c - f.x0) .| <=
        |. g .x1 -g.c .|+ |. f.c - f.x0 .| by COMPLEX1:56;
        |. g .x1 -g.c .|+ |. f.c - f.x0 .| < r/2+r/2 by P23,P24,XREAL_1:8;
        hence |.(F . x1) - (F . x0).| < r by P26,P27,XXREAL_0:2;
       end;
     end;
     hence thesis by P3,P8,XXREAL_0:21;
    end;
    suppose Q2a: x0 >= c; then
     Q2: x0 in Dg by XXREAL_1:236;
     Q1: x0 in dom (g|[.c,+infty.[) by RELAT_1:62,A3,Q2;
     consider sf being Real such that
     Q3: 0 < sf and
     Q4: for x1 being Real st x1 in Df & |. x1 - c .| < sf holds
     |. f.x1 - f.c .| < r/2 by FCONT_1:14,A1,A3,A7,A4;
     consider sg being Real such that
     Q8: 0 < sg and
     Q9: for x1 being Real st x1 in Dg & |. x1 - x0 .| < sg holds
     |. g . x1 - g . x0 .| < r/2 by FCONT_1:14,A1,A3,A4,Q2;
     SMin: min(sf,sg) <= sf & min(sf,sg) <= sg by XXREAL_0:17;
     take min(sf,sg);
     for x1 being Real st x1 in dom F & |.(x1 - x0).| < min(sf,sg)
     holds
     |.(F . x1) - (F . x0).| < r
     proof
      let x1 be Real;
      assume that x1 in dom F and
      Q7: |. x1 - x0 .| < min(sf,sg);
      QF: |.(F . x1) - (F . x0).|
       = |.(F . x1) - ((g|[.c,+infty.[) . x0).| by FUNCT_4:13,Q1
      .= |.(F . x1) - g . x0.| by FUNCT_1:49,XXREAL_1:236,Q2a;
      per cases;
       suppose Q11: x1 < c; then
        Q12:x1 in Df by XXREAL_1:234;
        Q12b: x1 <= x0 by Q2a,XXREAL_0:2,Q11; then
        c-c <= c-x1 & x0-x0 <= x0-x1 by XREAL_1:13,Q11; then
        X1: |. c-x1 .|= c-x1 & x0-x1 = |. x0-x1 .| by COMPLEX1:43;
        |. c-x1 .| <= |. x0-x1 .| by X1,XREAL_1:13,Q2a;then
        |. -(c-x1) .| <= |. (x0-x1) .| by COMPLEX1:52;then
        |. x1-c .| <= |. -(x0-x1) .| by COMPLEX1:52;then
        |. x1-c .| < min(sf,sg) by XXREAL_0:2,Q7;then
        |. x1-c .| < sf by XXREAL_0:2,SMin;then
       Q13: |. f.x1 - f.c .| < r/2 by Q4,Q12;
        x0-c >= c-c by XREAL_1:13,Q2a; then
        X2: x0-c = |. x0-c .| by COMPLEX1:43
        .= |. -(x0-c) .| by COMPLEX1:52;
        x0-x0 <= x0-x1 by XREAL_1:13,Q12b; then
        X3: x0-x1 = |. x0-x1 .| by COMPLEX1:43
        .= |. -(x0-x1) .| by COMPLEX1:52;
        |. c-x0 .| <= |. x1-x0 .| by XREAL_1:13,X2,X3,Q11;
        then
        |. c-x0 .| < min(sf,sg) by XXREAL_0:2,Q7; then
        |. c-x0 .| < sg by XXREAL_0:2,SMin; then
       Q14: |. g.c - g.x0 .| < r/2 by Q9,A7;
       Q16: |.(F . x1) - (F . x0).|
        = |. (f|Df) .x1 - g.x0 .| by FUNCT_4:11,XXREAL_1:236,Q11,AD,QF
        .= |. f.x1 -f.c + g.c - g.x0 .|
                   by A2,FUNCT_1:49,Q11,XXREAL_1:234;
       Q17: |. (f.x1 - f . c) + (g.c - g . x0) .| <=
        |. f. x1 - f.c .|+ |. g.c - g . x0.| by COMPLEX1:56;
        |. f. x1 - f.c .|+ |. g.c - g . x0.| < r/2+r/2 by Q13,Q14,XREAL_1:8;
        hence |. F.x1 - F.x0.| < r by Q16,Q17,XXREAL_0:2;
       end;
       suppose Q21: x1 >= c; then ::x1 in dom(g|Dg); ::::x0,x1 in Dg
        Q22: x1 in Dg by XXREAL_1:236;
        Q7a: |.x1 - x0.| < sg by XXREAL_0:2,Q7,SMin;
        |.(F . x1) - (F . x0).| = |.((g|[.c,+infty.[) . x1) - ( g. x0).|
                        by FUNCT_4:13,XXREAL_1:236,Q21,AD,QF
        .= |.(g . x1) - ( g. x0).| by FUNCT_1:49,XXREAL_1:236,Q21;
        then
        Q24: |.F.x1 - F.x0.| < r/2 by Q9,Q22,Q7a;
        r/2 +0 < r/2+ r/2 by XREAL_1:8,A4;
        hence |.F.x1 - F.x0.| < r by XXREAL_0:2,Q24;
       end;
     end;
     hence thesis by Q3,Q8,XXREAL_0:21;
    end;
  end;
  hence F is_continuous_in x0 by FCONT_1:3;
 end;
 hence thesis;
end;
